﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rappelz.GameServer.Network;

namespace Rappelz.GameServer
{
    public class CreatureStat
    {
        public short stat_id;
        public float strength;
        public float vital;
        public float dexterity;
        public float agility;
        public float intelligence;
        public float mentality;
        public float luck;

        public void WriteToPacket(PacketOut packet)
        {
            packet.WriteInt16(stat_id);
            packet.WriteInt16((short)(strength > 32000 ? 32000 : strength));
            packet.WriteInt16((short)(vital > 32000 ? 32000 : vital));
            packet.WriteInt16((short)(dexterity > 32000 ? 32000 : dexterity));
            packet.WriteInt16((short)(agility > 32000 ? 32000 : agility));
            packet.WriteInt16((short)(intelligence > 32000 ? 32000 : intelligence));
            packet.WriteInt16((short)(mentality > 32000 ? 32000 : mentality));
            packet.WriteInt16((short)(luck > 32000 ? 32000 : luck));
        }

        public void Reset(short v)
        {
            stat_id = v;
            strength = v;
            vital = v;
            dexterity = v;
            agility = v;
            intelligence = v;
            mentality = v;
            luck = v;
        }

        public void Copy(CreatureStat v)
        {
            stat_id = v.stat_id;
            strength = v.strength;
            vital = v.vital;
            dexterity = v.dexterity;
            agility = v.agility;
            intelligence = v.intelligence;
            mentality = v.mentality;
            luck = v.luck;
        }

        public void Add(CreatureStat v)
        {
            strength += v.strength;
            vital += v.vital;
            dexterity += v.dexterity;
            agility += v.agility;
            intelligence += v.intelligence;
            mentality += v.mentality;
            luck += v.luck;
        }
    }
}
